<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>去字符串头尾空格</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <!--好的代码像粥一样,是得用时间和精力熬的。-->
</head>
<body>
<h3> 2：去字符串头尾空格
    编写函数 trim,满足
    输入 ' abc   ';
    输出 'abc'
    输入 ' a bc   ';
    输出 'a bc'
</h3>
<script>
    function trim(str) {
        var res = str.replace(/^\s+/g, '').replace(/\s+$/g, '');
    }
    console.log(trim(' 111 '));


  //  function str(){
  //    var num = '      jlkljk     refgd   ';
  //    console.log($.trim(num));
  //  }
  // str();
</script>
</body>
</html>
